<?php

namespace App\Http\Controllers\admin;

use Illuminate\Http\Request;
use \DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use \App\Http\Requests\UserPostRequest;


class ProposalController extends Controller
{   
    /**
     * 获取数据表proposal的值带到页面
     * $num 显示条数
     * $proposal 反馈信息
     * $all 所有信息
     * @return 
     */
    public function getIndex(Request $request)
    {
    	//显示获取显示条数
        $num = $request->input('num',10);
        //查询反馈信息
        $proposal = DB::table('proposal')->paginate($num);
        //获取所有信息        
        $all = $request->all();       
        return view('admin.user.proposal',['all'=>$all,'proposal'=>$proposal]); 
    }

    /**
     * ajax删除反馈信息
     * $id 获取id
     * $res 执行删除反馈信息
     * @return vodi
     */
    public function postPrdel(Request $request)
    {
    	//获取id
    	$id = $request->input('id');
    	//根据id删除信息
    	$res = DB::table('proposal')->where('id',$id)->delete();
    	//判断
    	if($res){
    		echo 1;
    	}else{
    		echo 2;
    	}
    }


}
